package com.ruoyi.system.api.factory;

import com.ruoyi.system.api.RemoteWechatService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.List;

/**
 * 微信小程序登录服务降级处理
 *
 * @author ruoyi
 */
@Component
public class RemoteWechatFallbackFactory implements FallbackFactory<RemoteWechatService>
{
    private static final Logger log = LoggerFactory.getLogger(RemoteWechatFallbackFactory.class);

    @Override
    public RemoteWechatService create(Throwable throwable)
    {
        log.error("微信小程序授权登录服务调用失败:{}", throwable.getMessage());
        return new RemoteWechatService()
        {

            @Override
            public String formatLogin(String appid, String secret, String js_code, String grant_type) {
                return null;
            }

            @Override
            public String WECHAT_ACCESS_TOKEN_URL(String appid, String secret, String grant_type) {
                return null;
            }
        };
    }
}
